<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta http-equiv="x-ua-compatible" content="ie=7" />
        <title>订单详细</title>
        <link href="{:C('WEB_URL')}Public/admin/style/base.css" rel="stylesheet" type="text/css" />
        <link href="{:C('WEB_URL')}Public/admin/style/master.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/jquery1.9.1.js"></script>
        <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/base.js"></script>
    </head>
    <body>
        <div id="wrapper">
            <h2>订单详细<a href="javascript:history.go(-1);">返回</a></h2>
            <form action="{:U('insert')}" method="post" enctype="multipart/form-data" id="myform">
                <table class="form" >
                    <tr>
                        <td class="tkey">订单编号:</td>
                        <td>{$order.order_num}</td>
                    </tr>
                    <tr>
                        <td class="tkey">车主:</td>
                        <td>{$order.username}</td>
                    </tr>
					<tr>
                        <td class="tkey">车辆信息:</td>
                        <td><div>
							{$order['brand_name']} - {$order['model_name']} - {$order['model_pl']} - {$order['model_year']} 年
							<span style='padding-left:20px;'>车架号：{$order['vin']}</span>
							<span style='padding-left:20px;'>车牌号：{$order['number']}</span>
						</div>
                    </tr>
                    <tr>
                        <td class="tkey w160">维修厂名称:</td>
                        <td><div name='company' >去保养</div></td>
                    </tr>
                    <tr>
                        <td class="tkey">订单状态:</td>
                        <td><?php
					//status 10. 待支付 20.待发货 30.待收货 40.已收货  50.装配中  60.装配完成
						if($order['status'] < 60){
						 	echo "服务中";
						}else{
						 	echo '服务完成'.'&nbsp;&nbsp;&nbsp;&nbsp;完成时间:'.date("Y-m-d H:i:s",$order["end_time"]);
						}
					?></td>
                    </tr>
                    <?php if($order['js_id']){ ?>
                    <tr>
                        <td class="tkey">工位:</td>
                        <td><div>
							{$order['gw_id']} 号工位
							<span style='padding-left:20px;'>技师：{$order['js_id']} 号技师</span>
						</div>
                    </tr>
                    <?php } ?>
                    <tr>
                        <td class="tkey">支付类型:</td>
                        <td><?php 
							if($order['pay_type']==1){
								echo "<span style='color:green;font-weight:bold'>支付宝支付</span>";
							}else if($order['pay_type']==2){
								echo "<span style='color:green;font-weight:bold'>微信支付</span>";
							}else if($order['pay_type']==3){
								echo "<span style='color:green;font-weight:bold'>POS支付</span>";
							}else{
								echo "<span style='color:red;font-weight:bold'>未支付</span>";
							}
						 ?>
						</td>
                    </tr>
					 <tr>
                        <td class="tkey w160">订单总价:</td>
                        <td>￥{$order['all_price']}&nbsp;元</td>
                    </tr>
                    <?php if($order['address_start']){ ?>
                    <tr>
                        <td class="tkey">爱代驾接车单号:</td>
                        <td>
							单号：<input type="text" id="start" value="{$orderAdj[0]['adj_id']}" class="inputText" />
                            司机电话：<input type="text" id="startPhone" value="{$orderAdj[0]['phone']}" class="inputText" />
							<?php if(!$orderAdj[0]['adj_id']){ ?>
							<input type="button" style="margin-left:10px;" onclick="save(1);" value="保存"/>
							<?php } ?>
						<td>
                    </tr>
                    <?php if($orderAdj[0]['adj_id']){ ?>
                    <tr>
                        <td class="tkey">爱代驾还车单号:</td>
                        <td><div>
                            
                            <?php if($orderAdj[0]['adj_id']){ ?>
                            单号：<input type="text" id="end" value="{$orderAdj[1]['adj_id']}" class="inputText" />
                            司机电话：<input type="text" id="endPhone" value="{$orderAdj[1]['phone']}" class="inputText" />
                            <?php if(!$orderAdj[1]['adj_id']){ ?>
                            <input type="button" onclick="save(2);" value="保存"/>
                            <?php } ?>
                            <?php } ?>
                        </div><td>
                    </tr>
                    <?php } ?>
                    <tr>
                        <td class="tkey w160">接车地址:</td>
                        <td>{$order['address_start']}</td>
                    </tr>
                    <tr>
                        <td class="tkey w160">送车地址:</td>
                        <td>{$order['address_back']}</td>
                    </tr>
                    <tr>
                        <td class="tkey w160">订单总价:</td>
                        <td>￥{$order['all_price']}&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($order['wx_id']==441){echo '服务费:￥150元';} ?></td>
                    </tr>
                    <?php } ?>
					<style>
					#partList tr td{text-align:center;}
					</style>
					<table class="form" id="partList" style="text-align:center">
					 <tr>
                        <td class="tkey" style="width:10%">配件id</td>
                        <td class="tkey" style="width:10%">配件名称</td>
						<td class="tkey" style="width:10%">图片</td>
                        <td class="tkey" style="width:10%">市场价格</td>
                        <td class="tkey" style="width:10%">成本价格</td>
                        <td class="tkey"style="width:10%">出货价格</td>
						<td class="tkey"style="width:10%">购买数量(个)</td>
						<td class="tkey"style="width:10%">小计</td>
                    </tr>
					<volist name="orderInfo" id='vo'>
						<tr>
						<td class="tkey">{$vo['pj_id']}</td>
                        <td class="tkey"><?php if($vo['pj_name']){ echo $vo['pj_name'];}else{ echo $vo['content'];} ?></td>
						<td class="tkey"><img src="{:C('WEB_URL')}{$vo['logo']}" width='55px;'></td>
                        <td class="tkey">￥<?php if($vo['pj_scprice']){ ?> {$vo['pj_scprice']}<?php }else {echo '0';} ?>&nbsp;元</td>
                        <td class="tkey">￥<?php if($vo['pj_cbprice']){ ?> {$vo['pj_cbprice']}<?php }else{ echo '0';} ?>&nbsp;元</td>
                        <td class="tkey">￥<?php if($vo['pj_csprice']){ ?> {$vo['pj_csprice']}<?php }else{echo '0';} ?>&nbsp;元</td>
                        <td class="tkey">{$vo['count']}</td> 
                        <td class="tkey">￥ <?php if($vo['total']){ ?>{$vo['total']}<?php }else{ echo '0';}?>&nbsp;元</td>
						</tr>
					</volist>
					</table>
                   
                </table>
            </form>
        </div>
        <style>
            .picList li{float:left;margin:0 10px;}
            .picList li a{display:block;text-align:center;color:#f60}
        </style>
        <script>
        function save(type){
        	var id = '';
			if(type==1){
				id = $.trim($('#start').val());
                phone=$.trim($('#startPhone').val());
			}else{
				id = $.trim($('#end').val());
                phone=$.trim($('#endPhone').val());
			}
			if(id == ''){
				alert('单号不能为空!');
			}else{
                var url="{:C('WEB_URL')}/Admin/Order/savedj/id/"+id+"/order_id/"+{$order.order_id}+"/type/"+type+"/phone/"+phone;
                $.getJSON(url,function(data){
                	if(data){
        				alert('操作成功');
        				location.reload();
        			 }else{
        			 	alert('失败');
        			 }
                })
			}
        }
    </script>
    </body>
</html>